import { IClientTask, IClientVm, IConfig, ILog, IPatient, IResult } from '@/interface/common'
import request from '@/units/request'
import { AxiosPromise } from 'axios'

export const GetClientInfo = () : AxiosPromise<IResult<IClientVm>> =>
  request({
    url: '/api/SysClient',
    method: 'get'
  })

export const GetServerTime = () : AxiosPromise<IResult<Date>> =>
  request({
    url: '/api/SysClient/GetDate',
    method: 'get'
  })

export const GetConfig = () : AxiosPromise<IConfig> =>
  request({
    url: '/api/SysConfigGroup/List',
    method: 'get'
  })

export const AddLog = (data: ILog) : AxiosPromise<void> =>
  request({
    url: '/api/SysClientLog/AddLog',
    method: 'post',
    data
  })

export const GetUser = (data: IPatient) : AxiosPromise<IResult<IPatient>> =>
  request({
    url: '/api/SysPatient/GetUser',
    method: 'post',
    data
  })

export const GetUserByECode = (code: string) : AxiosPromise<IResult<IPatient>> =>
  request({
    url: `/api/SysPatient/GetUserByECode/${code}`,
    method: 'get'
  })

export const GetClientTask = () : AxiosPromise<IResult<IClientTask>> =>
  request({
    url: '/api/SysClientTask/GetTask/Web',
    method: 'get'
  })
